﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Effects
{
    public class SinusoidalTween : Tween
    {

        /// <summary>
        /// Creates a configurable empty tween
        /// </summary>
        public SinusoidalTween()
            : base()
        {
        }

        /// <summary>
        /// Create a tween that will contain a default startTime
        /// </summary>
        /// <param name="duration">The time it takes to tween the animation</param>
        /// <param name="startValue">Contains the value at which the tween starts to work</param>
        /// <param name="changeValue">Value to affect the start value with over time</param>
        public SinusoidalTween(double duration, double startValue, float changeValue)
            : base(duration, startValue, changeValue)
        {
        }

        /// <summary>
        /// Executes the formula to give you a return value that you can apply to your animation
        /// </summary>
        /// <param name="currentTime">Represents the T variable in an easing tween formula</param>
        public override double tweenValue(double currentTime)
        {
            return -this._changeValue * Math.Cos(currentTime / this._duration * (Math.PI / 2)) + this._changeValue + this._startValue;
        }

    }
}
